package com.topvision.common.exception;

import org.springframework.http.ResponseEntity;

import java.util.Map;

/**
 * @author shengwm
 * @version V0.0.1
 * @Title: BusinessException
 * @Package com.topvision.common.exception
 * @Description: 统一业务异常
 * @date 2017/4/25 16:06
 */
public class BusinessException extends RuntimeException {

    private ResponseEntity<Map<String, Object>> responseEntity;

    private String code;
    private String message;

    public BusinessException() {
        super();
        // TODO Auto-generated constructor stub
    }

    public BusinessException(String message, Throwable cause,
                             boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
        // TODO Auto-generated constructor stub
    }

    public BusinessException(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public BusinessException(String message, Throwable cause) {
        super(message, cause);
        // TODO Auto-generated constructor stub
    }

    public BusinessException(String message) {
        super(message);
        // TODO Auto-generated constructor stub
    }

    public BusinessException(Throwable cause) {
        super(cause);
        // TODO Auto-generated constructor stub
    }

    public BusinessException(ResponseEntity<Map<String, Object>> responseEntity) {
        this.responseEntity = responseEntity;
        // TODO Auto-generated constructor stub
    }

    /**
     * @return the responseEntity
     */
    public ResponseEntity<Map<String, Object>> getResponseEntity() {
        return responseEntity;
    }

    /**
     * @param responseEntity the responseEntity to set
     */
    public void setResponseEntity(ResponseEntity<Map<String, Object>> responseEntity) {
        this.responseEntity = responseEntity;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
